package MyTest;


import java.util.Scanner;

/*
class Test{
    public void show() {
        synchronized (this) {
            System.out.println("Hello World");
            try {
                this.wait();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
class Wait{

    public void showWait(){
        synchronized (this) {
            try {
                System.out.println("wait开始");
                this.wait();
                System.out.println("wait结束");
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}

class Notify {
    public void showNotify(){
        synchronized (this) {
            System.out.println("notify开始");
            this.notify();
            System.out.println("notify结束");
        }
    }
}
*/


public class TestDemo {
    public static void main(String[] args) {
        Thread thread = new Thread(()-> {

        });
    }
    /*public static void main5(String[] args) {
        Wait wait = new Wait();
        Notify notify = new Notify();
        Thread thread1 = new Thread(()->{
            while (true) {
                wait.showWait();
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });
        Thread thread2 = new Thread(()-> {
            notify.showNotify();
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        });
        thread1.start();
        thread2.start();
    }*/
   /* public static void main4(String[] args) throws InterruptedException {
        Object object = new Object();
        synchronized (object) {
            System.out.println("线程开始");
            object.wait();
            System.out.println("线程结束");
        }
        synchronized (object) {
            System.out.println("线程开始");
            object.notify();
            System.out.println("线程结束");
        }
    }

    public static void main3(String[] args) throws InterruptedException {
        Test test = new Test();
        Thread thread1 = new Thread(()-> {
            System.out.println("thread1线程下:");
            for (int i = 0; i < 2; i++) {
                test.show();
            }

        });

        Thread thread2 = new Thread(()-> {
            System.out.println("thread2线程下:");
            for (int i = 0; i < 2; i++) {
                test.show();
            }
        });
        thread1.start();

        thread2.start();

    }
    public static int flag = 0;
    public static void main2(String[] args) {
        Thread thread1 = new Thread(()-> {
            System.out.println("请输入");
           while (flag == 0) {

           }
        });
        Thread thread2 = new Thread(()-> {
            Scanner scanner = new Scanner(System.in);
            flag = scanner.nextInt();

        });
        thread1.start();
        thread2.start();

    }*/
}
